package com.enumconstant;

public enum OrderStatus {

    BRAND_NEW(0),NOT_PAY(1),PAID(2),FINISHED(3),EXCEPTION(4);

    OrderStatus(int status) {
        this.status = status;
    }

    private int status;

    public int getStatus() {
        return status;
    }

    public static OrderStatus of(int i){

        for (OrderStatus value : values()) {
            if(value.status==i){
                return value;
            }
        }
        return EXCEPTION;
    }

}
